SUBROUTINE CCEXPORT
 USE DAMOD
	INTEGER::A,B,C
    REAL PLOT(10,NNODES),DENOM(NNODES),OA,OB,OC,C_TER(2,NCELLS),M
	PLOT=0.
	DENOM=0.
	OA=0.
	OB=0.
	OC=0.
	C_TER=0.
   DO IE=1,NEDGES
   A=EDGE(1,IE);B=EDGE(2,IE);J=EDGE(3,IE);K=EDGE(4,IE)
   X=NODE(1,A)+NODE(1,B);Y=NODE(2,A)+NODE(2,B)
   C_TER(1,J)=C_TER(1,J)+X;C_TER(2,J)=C_TER(2,J)+Y
   IF(EDGE(5,IE)==0)THEN
   C_TER(1,K)=C_TER(1,K)+X;C_TER(2,K)=C_TER(2,K)+Y
   ENDIF
   ENDDO
 C_TER=C_TER/6.
	DO I=1,NCELLS
    A=CELL(1,I);B=CELL(2,I);C=CELL(3,I)
    OA=1./SQRT((NODE(1,A)-C_TER(1,I))**2+(NODE(2,A)-C_TER(2,I))**2)
	OB=1./SQRT((NODE(1,B)-C_TER(1,I))**2+(NODE(2,B)-C_TER(2,I))**2)
	OC=1./SQRT((NODE(1,C)-C_TER(1,I))**2+(NODE(2,C)-C_TER(2,I))**2)
    DENOM(A)=DENOM(A)+OA
	DENOM(B)=DENOM(B)+OB
	DENOM(C)=DENOM(C)+OC
  DEN=W(1,I)
	U=W(2,I)/W(1,I)
	V=W(3,I)/W(1,I)
	ENERGY=W(4,I)/W(1,I)
	H=ENERGY+(GAMA-1)*(ENERGY-0.5*(U**2+V**2))
	PRESURE=DEN*(H-ENERGY)
	SONIC=SQRT(GAMA*(H-ENERGY))
	M=SQRT(U**2+V**2)/SONIC
	PLOT(1,A)=PLOT(1,A)+OA*DEN
    PLOT(2,A)=PLOT(2,A)+OA*PRESURE
	PLOT(3,A)=PLOT(3,A)+OA*U
	PLOT(4,A)=PLOT(4,A)+OA*V
	PLOT(5,A)=PLOT(5,A)+OA*M
	PLOT(1,B)=PLOT(1,B)+OB*DEN
    PLOT(2,B)=PLOT(2,B)+OB*PRESURE
	PLOT(3,B)=PLOT(3,B)+OB*U
	PLOT(4,B)=PLOT(4,B)+OB*V
	PLOT(5,B)=PLOT(5,B)+OB*M
    PLOT(1,C)=PLOT(1,C)+OC*DEN
    PLOT(2,C)=PLOT(2,C)+OC*PRESURE
	PLOT(3,C)=PLOT(3,C)+OC*U
	PLOT(4,C)=PLOT(4,C)+OC*V
	PLOT(5,C)=PLOT(5,C)+OC*M
	ENDDO
	DO I=1,NNODES
	PLOT(1,I)=PLOT(1,I)/DENOM(I)
	PLOT(2,I)=PLOT(2,I)/DENOM(I)
	PLOT(3,I)=PLOT(3,I)/DENOM(I)
	PLOT(4,I)=PLOT(4,I)/DENOM(I)
	PLOT(5,I)=PLOT(5,I)/DENOM(I)
	ENDDO
	OPEN(5,FILE='ccnaca0012.PLT',FORM='FORMATTED')
	WRITE(5,*)'TITLE = "2D NACA0012 EULAR RESULT"'
	WRITE(5,*)'VARIABLES= "X","Y","DEN","P","U","V","MA"'
	WRITE(5,*)'ZONE N=',NNODES,',E=',NCELLS,',F=FEPOINT,ET=TRIANGLE'
	WRITE(5,71)((NODE(J,I),J=1,2),(PLOT(K,I),K=1,5),I=1,NNODES)
	WRITE(5,32)((CELL(J,I),J=1,3),I=1,NCELLS)
	CLOSE(5)
	PRINT*,'cc exported'
21    FORMAT(2E15.7)
32    FORMAT(3I7)
41    FORMAT(4E15.7)
71    FORMAT(7E15.7)
46    FORMAT(3E15.7)
END
